#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpSocket>
#include <QLineEdit>
#include <QPushButton>
#include <QComboBox>
#include <QVBoxLayout>
#include <QLabel>
#include <QPointer>
#include "patientdashboard.h" // 包含患者仪表板的头文件
// 前向声明 PatientDashboard
class PatientDashboard;
class MainWindow : public QMainWindow {
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void onLoginButtonClicked();
    void onRegisterButtonClicked(); // 这里声明槽函数
    void onRegisterSubmit();
    void onBackButtonClicked();

private:
    void setupUI();
    void showRegistrationForm();
    void showPatientDashboard();

    QTcpSocket *tcpSocket;

    // 登录界面的控件
    QLineEdit *usernameEdit;
    QLineEdit *passwordEdit;
    QComboBox *roleComboBox;
    QPushButton *loginButton;
    QPushButton *registerButton;

    // 注册界面的控件
    QLineEdit *idEdit;
    QLineEdit *nameEdit;
    QLineEdit *sexEdit;
    QLineEdit *ageEdit;
    QLineEdit *phoneEdit;
    QLineEdit *addressEdit;
    QLineEdit *passwardEdit;
    QPushButton *registerButtonSubmit;
    QPushButton *backButton;

    QPointer<PatientDashboard> dashboard; // 正确在这里声明
};

#endif // MAINWINDOW_H
